package cn.chrisn;

import java.util.function.IntConsumer;
import java.util.function.IntPredicate;

/**
 * @Description
 * @Author Chrisn
 * @Date 2025/4/26
 */
public class foreachArrTest {

    public static void main(String[] args) {
        foreachArr(value -> System.out.println(value));


//        foreachArr((int value)->{
//            System.out.println(value);
//        });

//        foreachArr(new IntConsumer() {
//            @Override
//            public void accept(int value) {
//                System.out.println(value);
//            }
//        });
    }

    public static void foreachArr(IntConsumer consumer) {
        int[] arr={1,2,3,4,5,6,7,8,9,10};
        for (int i : arr) {
            consumer.accept(i);
        }
    }
}
